<?php

namespace app\common\model;

use think\Model;
use traits\model\SoftDelete;

/**
 * @brief   缴费记录
 * @author wanchengniuniu
 * @date 2025/2/27
 */
class PaymentRecords extends Model
{
    use SoftDelete;

    // 表名
    protected $name = 'user_payment_records';
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = 'deletetime';

    const STATUS_NORMAL = 1;//已缴费
    const STATUS_DEFAULT = 0;//未缴费

    const TYPE_FANG = 1;//房租
    const TYPE_OTHER = 2;//水电物业费


    static public function getStatusList($type = 2, $value = 1)
    {
        $data = [
            self::STATUS_NORMAL => '已缴费',
            self::STATUS_DEFAULT => '未缴费',
        ];
        if ($type == 1) {
            return isset($data[$value]) ? $data[$value] : '';
        } else {
            return $data;
        }
    }

    static public function getTypeList($type = 2, $value = 1)
    {
        $data = [
            self::TYPE_FANG => '房租',
            self::TYPE_OTHER => '水电物业费',
        ];
        if ($type == 1) {
            return isset($data[$value]) ? $data[$value] : '';
        } else {
            return $data;
        }
    }


}
